<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFrameworks>$(NetCoreAppToolCurrent);$(NetFrameworkToolCurrent)</TargetFrameworks>
    <OutputType>Library</OutputType>
    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
    <EnableDefaultCompileItems>false</EnableDefaultCompileItems>
    <Nullable>enable</Nullable>
    <NoWarn>$(NoWarn),CA1050,CA1850</NoWarn>

    <!-- Ignore nullable warnings on net4* -->
    <NoWarn Condition="$(TargetFramework.StartsWith('net4'))">$(NoWarn),CS8604,CS8602</NoWarn>
    <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.Build" Version="$(MicrosoftBuildVersion)" />
    <PackageReference Include="Microsoft.Build.Tasks.Core" Version="$(MicrosoftBuildTasksCoreVersion)" />
    <PackageReference Include="System.Reflection.Metadata" Version="$(SystemReflectionMetadataToolsetVersion)" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="MonoAOTCompiler.cs" />
    <Compile Include="..\Common\CompilerCache.cs" />
    <Compile Include="..\Common\ProxyFile.cs" />
    <Compile Include="..\Common\FileCache.cs" />
    <Compile Include="..\Common\Utils.cs" />
    <Compile Include="..\Common\LogAsErrorException.cs" />
    <Compile Include="..\Common\TempFileName.cs" />
    <Compile Include="$(RepoRoot)src\libraries\System.Private.CoreLib\src\System\Diagnostics\CodeAnalysis\NullableAttributes.cs" Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'" />
  </ItemGroup>
  <ItemGroup>
    <Content Include="MonoAOTCompiler.props">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
  </ItemGroup>

  <!-- GetFilesToPackage assists to place `MonoAOTCompiler.dll` in a NuGet package in Microsoft.NET.Runtime.MonoAOTCompiler.Task.pkgproj for external use -->
  <Target Name="GetFilesToPackage" Returns="@(FilesToPackage)">
    <ItemGroup>
      <_PublishFramework Remove="@(_PublishFramework)" />
      <_PublishFramework Include="$(TargetFrameworks)" />

      <FilesToPackage Include="$(OutputPath)%(_PublishFramework.Identity)\$(AssemblyName).dll" TargetPath="tasks\%(_PublishFramework.Identity)" />
      <FilesToPackage Include="$(OutputPath)%(_PublishFramework.Identity)\$(AssemblyName).pdb" TargetPath="tasks\%(_PublishFramework.Identity)" />

      <!-- for net472 we need all the dependent assemblies too, so copy from the publish folder -->
      <FilesToPackage Include="$(OutputPath)$(NetFrameworkToolCurrent)\*.dll*"
                      TargetPath="tasks\$(NetFrameworkToolCurrent)" />
    </ItemGroup>
  </Target>
</Project>
